from selenium import webdriver
from selenium.webdriver.common.by import By
import time

d = webdriver.Chrome()
d.get("https://www.baidu.com")
time.sleep(3)
# 定位到hao123这个文本连接
# a_ele = d.find_element(By.LINK_TEXT, 'hao123')

# 根据标签名定位
# d.find_element(By.TAG_NAME, '标签名')

# 局部的文件链接定位
a_ele = d.find_element(By.PARTIAL_LINK_TEXT, 'hao123')
a_ele.click()
time.sleep(3)

d.quit()
